<template>
  <div class="">
    <van-nav-bar
      title="详细资料"
      left-text="返回"
      left-arrow
      @click-left="$router.back()"
    />
    <div class="rec_top">
      <div class="top_top">
        <div class="one_left">
          <img :src="narryInfo.narry_phone" alt="" />
        </div>
        <div class="one_right">
          <h4>{{ narryInfo.nanny_name }}</h4>
          <div class="postdiv">{{ narryInfo.post }}</div>

          <div class="right_up">
            <span
              >学历：<strong>{{ narryInfo.nanny_zodiac }}</strong>
            </span>
            <span
              >属相：<strong>{{ narryInfo.nanny_educ }}</strong></span
            ><br />
            <span
              >民族：<strong>{{ narryInfo.nanny_nation }}</strong></span
            >
            <span
              >星座：<strong>{{ narryInfo.nanny_constellation }}</strong></span
            >
          </div>
          <div class="right_down">
            <span>{{ narryInfo.nanny_age }}岁年龄</span>
            <span>{{ narryInfo.nanny_experience }}</span>
            <span>{{ narryInfo.nanny_native }}籍</span>
          </div>
        </div>
      </div>
      <div class="top_bottom">
        <van-tag
          plain
          type="danger"
          v-for="(item, index) in narryInfo.credentials"
          :key="index"
          >{{ item }}</van-tag
        >
        <div class="comseal">
          <img
            src="http://static.daojia.com/jz/assets/user-product/jz-order-process/img/qualified.86a283e.png"
            alt=""
          />
        </div>
      </div>
    </div>
    <div class="certificate">
      <div class="cer_title">
        <img
          src="//static.daojia.com/jz/assets/user-product/jz-order-process/img/credentials.7942354.png"
          alt=""
        />证件证书
      </div>
      <div class="cer_centont">
        <div class="cer_li">
          <img
            src="//static.daojia.com/jz/assets/user-product/jz-order-process/img/beijingdiaocha.61c9e4c.png"
            alt=""
          />
          <div>背调合格</div>
        </div>
        <div class="cer_li">
          <img
            src="//static.daojia.com/jz/assets/user-product/jz-order-process/img/shenfenzheng.fbcd9d1.png"
            alt=""
          />
          <div>身份证</div>
        </div>
      </div>
    </div>

    <div class="job_int">
      <div class="job_title">
        <img
          src="//static.daojia.com/jz/assets/user-product/jz-order-process/img/intention.23363ee.png"
          alt=""
        />求职意向
      </div>
      <div class="job_content">
        <div>
          <span class="low_text">求职状态:</span
          ><span class="deep_text">{{ narryInfo.job_status }}</span>
        </div>
        <div>
          <span class="low_text">求职内容:</span
          ><span class="deep_text">{{ narryInfo.cook_level }}</span>
        </div>
        <div>
          <span class="low_text">意向城市:</span
          ><span class="deep_text">{{ narryInfo.want_city }}</span>
        </div>
        <div>
          <span class="low_text">每周休息:</span
          ><span class="deep_text">{{ narryInfo.rest }}</span>
        </div>
      </div>
    </div>
    <div class="bottom_btn">
      <van-button type="warning" @click="isPriceShow = true"
        >咨询价格</van-button
      >
    </div>

    <van-popup
      v-model="isPriceShow"
      closeable
      position="bottom"
      :style="{ height: '35%', width: '100%' }"
    >
      <van-form @submit="onSubmit">
        <van-field
          class="field"
          v-model="phone"
          name="phone"
          label="手机号码"
          placeholder="手机号码"
          :rules="[
            { required: true, message: '请填写手机号' },
            { pattern: /^1[3456789]\d{9}$/, message: '手机号码格式错误！' },
          ]"
        />
        <van-field
          v-model="address"
          name="address"
          label="服务地址"
          placeholder="服务地址"
          :rules="[{ required: true, message: '请填写服务地址' }]"
        />
        <div style="margin: 16px">
          <van-button round block type="warning" native-type="submit"
            >提交信息</van-button
          >
        </div>
      </van-form>
    </van-popup>
  </div>
</template>

<script>
import { getNarryById } from "@/api/home";
import { Toast } from "vant";

export default {
  props: {
    narryId: {
      type: [Number, String],
    },
  },
  data() {
    return {
      narryInfo: {},
      isPriceShow: false,
      phone: "",
      address: "",
    };
  },
  created() {
    this.getNarry();
  },
  methods: {
    async getNarry() {
      const res = await getNarryById(this.narryId);

      this.narryInfo = res[0];
      this.narryInfo.credentials = this.narryInfo.credentials.split(",");
      console.log(this.narryInfo);
    },
    onSubmit(values) {
      console.log("submit", values);
      Toast("信息已提交成功，请耐心等待客服联系");
      this.isPriceShow = false;
    },
  },
};
</script>
<style lang='less' scoped>
.bottom_btn {
  position: fixed;
  bottom: 0;
  left: 0;
  height: 70px;
  width: 100%;
  line-height: 55px;
  text-align: center;
  background-color: #ffffff;
  .van-button {
    width: 80%;
    background-image: linear-gradient(to right, #fc8150, #e74b4c);
    border-radius: 5px;
    margin-bottom: 10px;
  }
}
.top_top {
  display: flex;
  height: 180px;
  padding: 10px;
  background: url(//static.daojia.com/jz/assets/user-product/jz-order-process/img/baomuBg.0c73dd1.png)
    no-repeat;

  .one_left {
    position: relative;
    flex: 2;
    height: 160px;
    overflow: hidden;
    border-radius: 10px;
    margin-top: 10px;
    img {
      position: absolute;
      left: -27px;
      //   width: 130px;
      height: 160px;
    }
  }
  .one_right {
    flex: 5;
    color: #fff;
    position: relative;
    .postdiv {
      height: 15px;
      width: 40px;
      position: absolute;
      top: 16px;
      left: 95px;
      z-index: 1;
      border-radius: 3px;
      color: #fd5e44;
      text-align: center;
      font-size: 12px;
      background: linear-gradient(180deg, #fff0bb, #ffcaa8);
    }
    h4 {
      position: absolute;
      top: -25px;
      left: 15px;
      font-weight: 520;
    }
    .right_up {
      position: absolute;
      top: 45px;
      left: 15px;
      font-size: 14px;
      font-weight: 300;
      display: flex;
      flex-wrap: wrap;
      span {
        flex: 50%;
      }
    }
    .right_down {
      position: absolute;
      top: 120px;
      left: 15px;
      font-size: 16px;
      display: flex;
      justify-content: space-between;
      span {
        width: 20%;
        height: 34px;
      }
    }
  }
}
.top_bottom {
  background-color: #fff;
  height: 50px;
  padding-left: 10px;
  line-height: 40px;
  .van-tag {
    margin-right: 10px;
    height: 25px;
    background-color: #fff4f4;
  }
  .comseal {
    position: absolute;
    top: 200px;
    left: 230px;
    height: 78px;
    width: 120px;
    background-image: url(http://static.daojia.com/jz/assets/user-product/jz-order-process/img/qualified.86a283e.png);
    img {
      width: 100%;
      height: 100%;
    }
  }
}
.certificate {
  margin-top: 10px;
  height: 120px;
  background-color: #fff;
  .cer_title {
    padding-top: 15px;
    padding-left: 10px;
    font-size: 16px;
    img {
      width: 16px;
    }
  }
  .cer_centont {
    display: flex;
    justify-content: space-around;
    .cer_li {
      margin-top: 10px;
      font-size: 14px;
      text-align: center;
      img {
        height: 40px;
      }
    }
  }
}
.job_int {
  margin-top: 10px;
  margin-bottom: 10px;
  height: 200px;
  background-color: #fff;
  .job_title {
    padding-top: 15px;
    padding-left: 10px;
    font-size: 16px;
    img {
      width: 16px;
    }
  }
  .job_content {
    margin-left: 20px;
    margin-top: 20px;
    .low_text {
      font-size: 14px;
      color: #94aac2;
      margin-right: 20px;
    }
    .deep_text {
      font-size: 14px;
    }
  }
}
.van-popup {
  .van-button {
    position: absolute;
    bottom: 8px;
    left: 28px;
    width: 80%;
    background-image: linear-gradient(to right, #fc8150, #e74b4c);
    border-radius: 5px;
    margin-bottom: 10px;
  }
}
.field {
  margin-top: 45px;
}
</style>